/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ComponenteEntidad;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Marilyn
 */
@Entity
@Table(name = "bus")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Bus.findAll", query = "SELECT b FROM Bus b"),
    @NamedQuery(name = "Bus.findByIdbus", query = "SELECT b FROM Bus b WHERE b.idbus = :idbus"),
    @NamedQuery(name = "Bus.findByBusAnioFabricacion", query = "SELECT b FROM Bus b WHERE b.busAnioFabricacion = :busAnioFabricacion"),
    @NamedQuery(name = "Bus.findByBusFechaUso", query = "SELECT b FROM Bus b WHERE b.busFechaUso = :busFechaUso"),
    @NamedQuery(name = "Bus.findByBusPlacaRodaje", query = "SELECT b FROM Bus b WHERE b.busPlacaRodaje = :busPlacaRodaje"),
    @NamedQuery(name = "Bus.findByBusNroAutorizacionTransp", query = "SELECT b FROM Bus b WHERE b.busNroAutorizacionTransp = :busNroAutorizacionTransp"),
    @NamedQuery(name = "Bus.findByBusNroEjes", query = "SELECT b FROM Bus b WHERE b.busNroEjes = :busNroEjes"),
    @NamedQuery(name = "Bus.findByBusGlnsCombustible", query = "SELECT b FROM Bus b WHERE b.busGlnsCombustible = :busGlnsCombustible"),
    @NamedQuery(name = "Bus.findByBusNroPisos", query = "SELECT b FROM Bus b WHERE b.busNroPisos = :busNroPisos"),
    @NamedQuery(name = "Bus.findByBusNroAsientos1", query = "SELECT b FROM Bus b WHERE b.busNroAsientos1 = :busNroAsientos1"),
    @NamedQuery(name = "Bus.findByBusNroAsientos2", query = "SELECT b FROM Bus b WHERE b.busNroAsientos2 = :busNroAsientos2"),
    @NamedQuery(name = "Bus.findByBusNroTV1", query = "SELECT b FROM Bus b WHERE b.busNroTV1 = :busNroTV1"),
    @NamedQuery(name = "Bus.findByBusNroTV2", query = "SELECT b FROM Bus b WHERE b.busNroTV2 = :busNroTV2"),
    @NamedQuery(name = "Bus.findByBusSSHH", query = "SELECT b FROM Bus b WHERE b.busSSHH = :busSSHH"),
    @NamedQuery(name = "Bus.findByBusCapacidaBodega", query = "SELECT b FROM Bus b WHERE b.busCapacidaBodega = :busCapacidaBodega"),
    @NamedQuery(name = "Bus.findByBusObservaciones", query = "SELECT b FROM Bus b WHERE b.busObservaciones = :busObservaciones"),
    @NamedQuery(name = "Bus.findByBusDise\u00f1o", query = "SELECT b FROM Bus b WHERE b.busDise\u00f1o = :busDise\u00f1o")})
public class Bus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idbus")
    private Integer idbus;
    @Size(max = 5)
    @Column(name = "bus_AnioFabricacion")
    private String busAnioFabricacion;
    @Column(name = "bus_FechaUso")
    @Temporal(TemporalType.DATE)
    private Date busFechaUso;
    @Size(max = 30)
    @Column(name = "bus_PlacaRodaje")
    private String busPlacaRodaje;
    @Size(max = 30)
    @Column(name = "bus_NroAutorizacionTransp")
    private String busNroAutorizacionTransp;
    @Column(name = "bus_NroEjes")
    private Integer busNroEjes;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "bus_GlnsCombustible")
    private Float busGlnsCombustible;
    @Column(name = "bus_NroPisos")
    private Integer busNroPisos;
    @Column(name = "bus_NroAsientos1")
    private Integer busNroAsientos1;
    @Column(name = "bus_NroAsientos2")
    private Integer busNroAsientos2;
    @Column(name = "bus_NroTV1")
    private Integer busNroTV1;
    @Column(name = "bus_NroTV2")
    private Integer busNroTV2;
    @Column(name = "bus_SSHH")
    private Boolean busSSHH;
    @Size(max = 50)
    @Column(name = "bus_CapacidaBodega")
    private String busCapacidaBodega;
    @Size(max = 300)
    @Column(name = "bus_Observaciones")
    private String busObservaciones;
    @Size(max = 200)
    @Column(name = "bus_Dise\u00f1o")
    private String busDiseño;
    @JoinColumn(name = "idTipoCombustible", referencedColumnName = "idTipoCombustible")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Tipocombustible tipocombustible;
    @JoinColumn(name = "idModelo", referencedColumnName = "idModelo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Modelo modelo;
    @JoinColumn(name = "idMarca", referencedColumnName = "idMarca")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Marca marca;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bus", fetch = FetchType.LAZY)
    private List<Viaje> viajeList;

    public Bus() {
    }

    public Bus(Integer idbus) {
        this.idbus = idbus;
    }

    public Integer getIdbus() {
        return idbus;
    }

    public void setIdbus(Integer idbus) {
        this.idbus = idbus;
    }

    public String getBusAnioFabricacion() {
        return busAnioFabricacion;
    }

    public void setBusAnioFabricacion(String busAnioFabricacion) {
        this.busAnioFabricacion = busAnioFabricacion;
    }

    public Date getBusFechaUso() {
        return busFechaUso;
    }

    public void setBusFechaUso(Date busFechaUso) {
        this.busFechaUso = busFechaUso;
    }

    public String getBusPlacaRodaje() {
        return busPlacaRodaje;
    }

    public void setBusPlacaRodaje(String busPlacaRodaje) {
        this.busPlacaRodaje = busPlacaRodaje;
    }

    public String getBusNroAutorizacionTransp() {
        return busNroAutorizacionTransp;
    }

    public void setBusNroAutorizacionTransp(String busNroAutorizacionTransp) {
        this.busNroAutorizacionTransp = busNroAutorizacionTransp;
    }

    public Integer getBusNroEjes() {
        return busNroEjes;
    }

    public void setBusNroEjes(Integer busNroEjes) {
        this.busNroEjes = busNroEjes;
    }

    public Float getBusGlnsCombustible() {
        return busGlnsCombustible;
    }

    public void setBusGlnsCombustible(Float busGlnsCombustible) {
        this.busGlnsCombustible = busGlnsCombustible;
    }

    public Integer getBusNroPisos() {
        return busNroPisos;
    }

    public void setBusNroPisos(Integer busNroPisos) {
        this.busNroPisos = busNroPisos;
    }

    public Integer getBusNroAsientos1() {
        return busNroAsientos1;
    }

    public void setBusNroAsientos1(Integer busNroAsientos1) {
        this.busNroAsientos1 = busNroAsientos1;
    }

    public Integer getBusNroAsientos2() {
        return busNroAsientos2;
    }

    public void setBusNroAsientos2(Integer busNroAsientos2) {
        this.busNroAsientos2 = busNroAsientos2;
    }

    public Integer getBusNroTV1() {
        return busNroTV1;
    }

    public void setBusNroTV1(Integer busNroTV1) {
        this.busNroTV1 = busNroTV1;
    }

    public Integer getBusNroTV2() {
        return busNroTV2;
    }

    public void setBusNroTV2(Integer busNroTV2) {
        this.busNroTV2 = busNroTV2;
    }

    public Boolean getBusSSHH() {
        return busSSHH;
    }

    public void setBusSSHH(Boolean busSSHH) {
        this.busSSHH = busSSHH;
    }

    public String getBusCapacidaBodega() {
        return busCapacidaBodega;
    }

    public void setBusCapacidaBodega(String busCapacidaBodega) {
        this.busCapacidaBodega = busCapacidaBodega;
    }

    public String getBusObservaciones() {
        return busObservaciones;
    }

    public void setBusObservaciones(String busObservaciones) {
        this.busObservaciones = busObservaciones;
    }

    public String getBusDiseño() {
        return busDiseño;
    }

    public void setBusDiseño(String busDiseño) {
        this.busDiseño = busDiseño;
    }

    public Tipocombustible getTipocombustible() {
        return tipocombustible;
    }

    public void setTipocombustible(Tipocombustible tipocombustible) {
        this.tipocombustible = tipocombustible;
    }

    public Modelo getModelo() {
        return modelo;
    }

    public void setModelo(Modelo modelo) {
        this.modelo = modelo;
    }

    public Marca getMarca() {
        return marca;
    }

    public void setMarca(Marca marca) {
        this.marca = marca;
    }

    @XmlTransient
    public List<Viaje> getViajeList() {
        return viajeList;
    }

    public void setViajeList(List<Viaje> viajeList) {
        this.viajeList = viajeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idbus != null ? idbus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bus)) {
            return false;
        }
        Bus other = (Bus) object;
        if ((this.idbus == null && other.idbus != null) || (this.idbus != null && !this.idbus.equals(other.idbus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ComponenteEntidad.Bus[ idbus=" + idbus + " ]";
    }
    
}
